using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ACME.Northwind.DataTransfer;
using ACME.Northwind.Service.Interfaces;
using ACME.Northwind.MockProxy.EventArgs;

namespace ACME.Northwind.MockProxy
{
	/// <summary>
	/// The service implementation for EmployeeTerritory object
	/// </summary>
	public partial class EmployeeTerritoryService : IEmployeeTerritoryService
	{
		#region IEmployeeTerritoryService Members

		/// <summary>
		/// Run the mock for the select by the primary key
		/// </summary>
		public EmployeeTerritoryDTO SelectByPrimaryKey(int employeeid, string territoryid)
		{
			EmployeeTerritoryPrimaryKeyEventArgs eventArgs = new EmployeeTerritoryPrimaryKeyEventArgs(employeeid, territoryid);
			this.OnMockEmployeeTerritorySelectByPrimaryKey(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for select all
		/// </summary>
		public List<EmployeeTerritoryDTO> RunSelect()
		{
			EmployeeTerritoryRunSelectEventArgs eventArgs = new EmployeeTerritoryRunSelectEventArgs();
			this.OnMockEmployeeTerritoryRunSelect(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for select with LINQ
		/// </summary>
		public List<EmployeeTerritoryDTO> RunSelect(string linq)
		{
			EmployeeTerritoryRunSelectLINQEventArgs eventArgs = new EmployeeTerritoryRunSelectLINQEventArgs(linq);
			this.OnMockEmployeeTerritoryRunSelectLINQ(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for paged select
		/// </summary>
		public PagedQueryResults<EmployeeTerritoryDTO> RunSelect(int pageIndex, int pageSize, bool ascending, string sortColumn, string linq)
		{
			EmployeeTerritoryRunSelectPagedEventArgs eventArgs = new EmployeeTerritoryRunSelectPagedEventArgs(pageIndex, pageSize, ascending, sortColumn, linq);
			this.OnMockEmployeeTerritoryRunSelectPaged(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Return the related Employee item
		/// </summary>
		public EmployeeDTO GetEmployeeItem(EmployeeTerritoryDTO item)
		{
			EmployeeDTO retval = new EmployeeDTO();
			EmployeeTerritoryDTOEventArgs eventArgs = new EmployeeTerritoryDTOEventArgs(item);
			this.OnMockGetEmployeeItem(eventArgs);
			retval = (EmployeeDTO)eventArgs.ReturnDTOItem;
			return retval;
		}

		/// <summary>
		/// Return the related Territory item
		/// </summary>
		public TerritoryDTO GetTerritoryItem(EmployeeTerritoryDTO item)
		{
			TerritoryDTO retval = new TerritoryDTO();
			EmployeeTerritoryDTOEventArgs eventArgs = new EmployeeTerritoryDTOEventArgs(item);
			this.OnMockGetTerritoryItem(eventArgs);
			retval = (TerritoryDTO)eventArgs.ReturnDTOItem;
			return retval;
		}

		/// <summary>
		/// Persists a single item
		/// </summary>
		public bool Persist(EmployeeTerritoryDTO dto)
		{
			EmployeeTerritoryPersistEventArgs eventArgs = new EmployeeTerritoryPersistEventArgs(dto);
			this.OnMockEmployeeTerritoryPersist(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Persists a list
		/// </summary>
		public bool Persist(List<EmployeeTerritoryDTO> list)
		{
			EmployeeTerritoryPersistEventArgs eventArgs = new EmployeeTerritoryPersistEventArgs(list);
			this.OnMockEmployeeTerritoryPersist(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Delete a single item
		/// </summary>
		public bool Delete(EmployeeTerritoryDTO dto)
		{
			EmployeeTerritoryDeleteEventArgs eventArgs = new EmployeeTerritoryDeleteEventArgs(dto);
			this.OnMockEmployeeTerritoryDelete(eventArgs);
			return eventArgs.ReturnValue;
		}

		#endregion

		#region EmployeeTerritory Events

		partial void GetSelectByPrimaryKey();

		/// <summary>
		/// The event for the SelectByPrimaryKey method
		/// </summary>
		public event EventHandler<EmployeeTerritoryPrimaryKeyEventArgs> MockEmployeeTerritorySelectByPrimaryKey;

		/// <summary>
		/// Raises the OnMockRegistrationCodeSelectByPrimaryKey event
		/// </summary>
		protected virtual void OnMockEmployeeTerritorySelectByPrimaryKey(EmployeeTerritoryPrimaryKeyEventArgs e)
		{
			if (this.MockEmployeeTerritorySelectByPrimaryKey != null)
				this.MockEmployeeTerritorySelectByPrimaryKey(this, e);
		}

		/// <summary>
		/// The event for the RunSelect method
		/// </summary>
		public event EventHandler<EmployeeTerritoryRunSelectEventArgs> MockEmployeeTerritoryRunSelect;

		/// <summary>
		/// Raises the OnMockRunSelect event
		/// </summary>
		protected virtual void OnMockEmployeeTerritoryRunSelect(EmployeeTerritoryRunSelectEventArgs e)
		{
			if (this.MockEmployeeTerritoryRunSelect != null)
				this.MockEmployeeTerritoryRunSelect(this, e);
		}

		/// <summary>
		/// The event for the RunSelectLINQ method
		/// </summary>
		public event EventHandler<EmployeeTerritoryRunSelectLINQEventArgs> MockEmployeeTerritoryRunSelectLINQ;

		/// <summary>
		/// The event for the OnMockRunSelectLINQ method
		/// </summary>
		protected virtual void OnMockEmployeeTerritoryRunSelectLINQ(EmployeeTerritoryRunSelectLINQEventArgs e)
		{
			if (this.MockEmployeeTerritoryRunSelectLINQ != null)
				this.MockEmployeeTerritoryRunSelectLINQ(this, e);
		}

		/// <summary>
		/// The event for the RunSelectPaged method
		/// </summary>
		public event EventHandler<EmployeeTerritoryRunSelectPagedEventArgs> MockEmployeeTerritoryRunSelectPaged;

		/// <summary>
		/// The event for the OnMockRunSelectPaged method
		/// </summary>
		protected virtual void OnMockEmployeeTerritoryRunSelectPaged(EmployeeTerritoryRunSelectPagedEventArgs e)
		{
			if (this.MockEmployeeTerritoryRunSelectPaged != null)
				this.MockEmployeeTerritoryRunSelectPaged(this, e);
		}

		/// <summary>
		/// The event for the GetEmployeeItem method
		/// </summary>
		public event EventHandler<EmployeeTerritoryDTOEventArgs> MockGetEmployeeItem;

		/// <summary>
		/// The event for the OnMockGetEmployeeItem method
		/// </summary>
		protected virtual void OnMockGetEmployeeItem(EmployeeTerritoryDTOEventArgs e)
		{
			if (this.MockGetEmployeeItem != null)
				this.MockGetEmployeeItem(this, e);
		}

		/// <summary>
		/// The event for the GetTerritoryItem method
		/// </summary>
		public event EventHandler<EmployeeTerritoryDTOEventArgs> MockGetTerritoryItem;

		/// <summary>
		/// The event for the OnMockGetTerritoryItem method
		/// </summary>
		protected virtual void OnMockGetTerritoryItem(EmployeeTerritoryDTOEventArgs e)
		{
			if (this.MockGetTerritoryItem != null)
				this.MockGetTerritoryItem(this, e);
		}

		/// <summary>
		/// The event for the Persist method
		/// </summary>
		public event EventHandler<EmployeeTerritoryPersistEventArgs> MockEmployeeTerritoryPersist;

		/// <summary>
		/// Raises the OnMockPersist event
		/// </summary>
		protected virtual void OnMockEmployeeTerritoryPersist(EmployeeTerritoryPersistEventArgs e)
		{
			if (this.MockEmployeeTerritoryPersist != null)
				this.MockEmployeeTerritoryPersist(this, e);
		}

		/// <summary>
		/// The event for the Delete method
		/// </summary>
		public event EventHandler<EmployeeTerritoryDeleteEventArgs> MockEmployeeTerritoryDelete;

		/// <summary>
		/// Raises the OnMockDelete event
		/// </summary>
		protected virtual void OnMockEmployeeTerritoryDelete(EmployeeTerritoryDeleteEventArgs e)
		{
			if (this.MockEmployeeTerritoryDelete != null)
				this.MockEmployeeTerritoryDelete(this, e);
		}

		#endregion

	}
}
